using System;
using System.Collections.Generic;
using Dict.DataModel;

namespace Dict.Dao
{
    public class TableFieldResourceDao:DaoBase<TableFieldResource>
    {
        public override void AddPrimaryIndex(TableFieldResource model)
        {
            cachePrimary[model.id.ToString()] = model;
        }

        public override string GetFileName()
        {
            return "TableFieldResource.txt";
        }

        protected override TableFieldResource ParseRowData(string[] rowData)
        {
            TableFieldResource data = new TableFieldResource();
			data.id = rowData [0];

            if (string.IsNullOrEmpty(rowData[1]))
            {
                data.level = 0;
            }
            else
            {
                data.level = int.Parse(rowData[1]);
            }
			data.model = rowData [2];

            if (string.IsNullOrEmpty(rowData[3]))
            {
                data.gatherTime = 0;
            }
            else
            {
                data.gatherTime = int.Parse(rowData[3]);
            }

            if (string.IsNullOrEmpty(rowData[4]))
            {
                data.cdTime = 0;
            }
            else
            {
                data.cdTime = int.Parse(rowData[4]);
            }

            if (string.IsNullOrEmpty(rowData[5]))
            {
                data.times = 0;
            }
            else
            {
                data.times = int.Parse(rowData[5]);
            }
			data.cost = rowData [6];
			data.rewardProbId = rowData [7];

            return data;
        }



    }

}
